//
//  AWProtocol.h
//  AtWork2
//
//  Created by lucas on 15/4/22.
//  Copyright (c) 2015年 Foreveross. All rights reserved.
//

#import <Foundation/Foundation.h>

FOUNDATION_EXPORT const UInt8 AWProtocolConnectType;
FOUNDATION_EXPORT const UInt8 AWProtocolConnectAckType;
FOUNDATION_EXPORT const UInt8 AWProtocolConnectRstType;
FOUNDATION_EXPORT const UInt8 AWProtocolPingType;
FOUNDATION_EXPORT const UInt8 AWProtocolPongType;
FOUNDATION_EXPORT const UInt8 AWProtocolPostType;
FOUNDATION_EXPORT const UInt8 AWProtocolDisConnectType;

/**
 *  消息协议
 */
@interface AWProtocol : NSObject

@property (nonatomic, assign, readonly) UInt8 type;

@property (nonatomic, assign, readonly) UInt8 qos;

@property (nonatomic, assign, readonly) UInt8 digestSize;

@property (nonatomic, assign, readonly) UInt8 digest;

@property (nonatomic, assign, readonly) UInt16 bodySize;

@property (nonatomic, strong, readonly) NSData *body;

+ (instancetype)protocolWithType:(UInt8)type
                             qos:(UInt8)qos
                      digestSize:(UInt8)digestSize
                          digest:(UInt8)digest
                        bodySize:(UInt16)bodySize
                            body:(NSData *)body;

- (instancetype)initWithType:(UInt8)type
                             qos:(UInt8)qos
                      digestSize:(UInt8)digestSize
                          digest:(UInt8)digest
                        bodySize:(UInt16)bodySize
                            body:(NSData *)body;
@end
